package com.gome.entity;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_menu")
public class Menu implements Serializable {
    @TableId
    private int nId;
    /** 菜单编码 */
    private String ocMenubm;
    /** 菜单名称 */
    @NotBlank(message = "菜单名称不能为空")
    private String vcMenumc;
    /** 菜单路径 */
    private String vcUrl;
    /** 父菜单编码 */
    private String ocParentbm;
    /** 父菜单名称 */
    private String vcParentmc;
    /** 级别 */
    private int nLevel;
    /** 排序 */
    private int nOrder;
    /** 图标 */
    private String ocIcon;
    /** 级别编码 */
    private String ocJbbm;
    /** 级别名称 */
    private String vcJbmc;

    private String ocCzy;
    private Date dtCzrq;
    /** 子菜单信息 */
    private List<Menu> children;
    /** 选择标志 0 未选择 1 已选择 */
    private Boolean checked;
    private String name; //映射树
    private String ocRolebm;//方便查询
    public Menu(String ocMenubm, String vcMenumc) {
        this.ocMenubm = ocMenubm;
        this.vcMenumc = vcMenumc;
    }

    public int getnLevel() {
        return nLevel;
    }

    public void setnLevel(int nLevel) {
        this.nLevel = nLevel;
    }

    public int getnOrder() {
        return nOrder;
    }

    public void setnOrder(int nOrder) {
        this.nOrder = nOrder;
    }

    public static Menu valueOf(String strMenu) {
      return  JSON.parseObject(strMenu.replaceAll(" ", ""), Menu.class);
    }

}
